package com.cat.bitOperation;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/find-the-original-array-of-prefix-xor/
 * @create 2025/8/20 09:16
 * @since JDK17
 */

public class Solution01 {
    public int[] findArray(int[] pref) {
        int n = pref.length, sum = 0;
        int[] ans = new int[n];
        for (int i = 0; i < n; i++) {
            ans[i] = sum ^ pref[i];
            sum ^= ans[i];
        }
        return ans;
    }
}
